helm repo remove dgraph
helm repo add dgraph https://charts.dgraph.io
helm repo update dgraph

export NS="dgraph-system"
export LAMBDA_REL="dgraph-lambda"
export DGRAPH_REL="dgraph"
export Lambda_repository="dgraph/dgraph-lambda"
export repository="dgraph/dgraph" # dgraph/standalone 带有ui界面  dgraph/dgraph

helm upgrade --install $DGRAPH_REL $repository \
  --create-namespace --namespace $NS \
  --values my-config-values.yaml \
  --set alpha.extraEnvs[0].name=DGRAPH_ALPHA_GRAPHQL \
  --set alpha.extraEnvs[0].value=lambda-url=http://$LAMBDA_REL-dgraph-lambda.$NS.svc:80/graphql-worker

helm upgrade --install $LAMBDA_REL $Lambda_repository \
  --namespace $NS \
  --set image.tag="latest" \
  --set env[0].name=DGRAPH_URL \
  --set env[0].value=http://$DGRAPH_REL-dgraph-alpha-headless.$NS.svc:8080
# --values my-config-lambda.yaml

# kubectl create ns dgraph

#单集群
# kubectl create -f https://raw.githubusercontent.com/dgraph-io/dgraph/master/contrib/config/kubernetes/dgraph-single/dgraph-single.yaml -n dgraph

# 删除单集群

# kubectl delete --filename https://raw.githubusercontent.com/dgraph-io/dgraph/master/contrib/config/kubernetes/dgraph-single/dgraph-single.yaml
# kubectl delete persistentvolumeclaims --selector app=dgraph

#高可用集群
# kubectl create -f https://raw.githubusercontent.com/dgraph-io/dgraph/master/contrib/config/kubernetes/dgraph-ha/dgraph-ha.yaml -n dgraph

#删除多集群

# kubectl delete --filename https://raw.githubusercontent.com/dgraph-io/dgraph/master/contrib/config/kubernetes/dgraph-ha/dgraph-ha.yaml -n dgraph
# kubectl delete persistentvolumeclaims --selector app=dgraph-zero -n dgraph
# kubectl delete persistentvolumeclaims --selector app=dgraph-alpha -n dgraph

# 开放端口
# kubectl port-forward service/dgraph-alpha-public 8080:8080 -n dgraph

# helm install dgraph dgraph/dgraph --create-namespace -n dgraph --set image.tag="v21.03.2"

# helm install dgraph-func dgraph/dgraph-lambda -n dgraph

#helm delete dgraph
#kubectl delete pvc --selector release=dgraph

# docker run --rm -it -p "8080:8080" -p "9080:9080" -p "8000:8000" -v $HOME/dgraph:/dgraph "dgraph/standalone"

# dgraph cloud api keys:  NTFjOTFjMTdjOWI4MDBkZDY1MjE4MmU4ODM0ODRhNWM=
